package com.web.music.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue("ARTIST")
public abstract class Artist implements PersistentObject {

	
	@Id
	private Long id;
	
	@ManyToMany
	private List<Genre> genres = new ArrayList<Genre>();
	
	@OneToMany(mappedBy="artist")
	private List<Album> albums;

	public List<Genre> getGenres() {
		return genres;
	}

	public Artist() {
		super();
	}

	public Artist(Long id) {
		super();
		this.id = id;
	}

	public Artist(List<Genre> genres, Long id) {
		super();
		this.genres = genres;
		this.id = id;
	}

	public void setGenres(List<Genre> genres) {
		this.genres = genres;
	}

	public List<Album> getAlbums() {
		return albums;
	}

	public void setAlbums(List<Album> albums) {
		this.albums = albums;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
}
